package cn.uyunsky.platform.config.bean.menu;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * <p>
 * 菜单的层级关系
 * <p>
 * 每个模块包含一组<code>交易</code>和下级的<code>模块</code>列表
 * 
 * @author baiyh
 * @date 2011-1-22
 */
public class PlModule {

	private String id;
	private String text;
	private boolean expanded = false;
	private Set<PlTran> trans = new LinkedHashSet<PlTran>();
	private Set<PlModule> children = new LinkedHashSet<PlModule>();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Set<PlTran> getTrans() {
		return trans;
	}

	public void setTrans(Set<PlTran> trans) {
		this.trans = trans;
	}

	public void addTran(PlTran tran) {
		trans.add(tran);
	}

	public Set<PlModule> getChildren() {
		return children;
	}

	public void setChildren(Set<PlModule> children) {
		this.children = children;
	}

	public void addModule(PlModule module) {
		children.add(module);
	}

	public boolean isExpanded() {
		return expanded;
	}

	public void setExpanded(boolean expanded) {
		this.expanded = expanded;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("PlModule [children=");
		builder.append(children);
		builder.append(", expanded=");
		builder.append(expanded);
		builder.append(", id=");
		builder.append(id);
		builder.append(", text=");
		builder.append(text);
		builder.append(", trans=");
		builder.append(trans);
		builder.append("]");
		return builder.toString();
	}

}
